updated spec

Judy Ngai 9 years ago
parent
commit
6f21fe24d6
1 changed files with 7 additions and 7 deletions
  1. 7 7
      spec/models/agents/twitter_user_agent_spec.rb

+ 7 - 7
spec/models/agents/twitter_user_agent_spec.rb

@@ -3,7 +3,7 @@ require 'rails_helper'
3 3
 describe Agents::TwitterUserAgent do
4 4
   before do
5 5
     # intercept the twitter API request for @tectonic's user profile
6
-    stub_request(:any, /tectonic/).to_return(:body => File.read(Rails.root.join("spec/data_fixtures/user_tweets.json")), :status => 200)
6
+    stub_request(:any, "https://api.twitter.com/1.1/statuses/home_timeline.json?contributor_details=true&count=200&exclude_replies=false&include_entities=true&include_rts=true").to_return(:body => File.read(Rails.root.join("spec/data_fixtures/user_tweets.json")), :status => 200)
7 7
 
8 8
     @opts = {
9 9
       :username => "tectonic",
@@ -15,7 +15,7 @@ describe Agents::TwitterUserAgent do
15 15
       :consumer_secret => "---",
16 16
       :oauth_token => "---",
17 17
       :oauth_token_secret => "---",
18
-      :choose_home_time_line => 'false'
18
+      :choose_home_time_line => 'true'
19 19
     }
20 20
 
21 21
     @checker = Agents::TwitterUserAgent.new(:name => "tectonic", :options => @opts)
@@ -43,16 +43,16 @@ describe Agents::TwitterUserAgent do
43 43
     end
44 44
   end
45 45
 
46
-  describe "#check that home timeline works" do
46
+  describe "#check that user timeline works" do
47 47
     before do
48
-      stub_request(:any, "https://api.twitter.com/1.1/statuses/home_timeline.json?contributor_details=true&count=200&exclude_replies=false&include_entities=true&include_rts=true").to_return(:body => File.read(Rails.root.join("spec/data_fixtures/user_tweets.json")), :status => 200)
48
+      stub_request(:any, /tectonic/).to_return(:body => File.read(Rails.root.join("spec/data_fixtures/user_tweets.json")), :status => 200)
49 49
     end
50 50
 
51
-    it "should check that event changed with timeline sets to true" do
51
+    it "should check that event changed with timeline sets to false" do
52 52
       
53
-      opts = @opts.tap { |ots| ots.delete(:username)}.merge({ :choose_home_time_line => "true" })
53
+      opts = @opts.merge({:choose_home_time_line => "false" })
54 54
 
55
-      checker = Agents::TwitterUserAgent.new(:name => "tectonic", :options => opts)
55
+      checker = Agents::TwitterUserAgent.new(:name => "tectonic", :options => @opts1)
56 56
       checker.service = services(:generic)
57 57
       checker.user = users(:bob)
58 58
       checker.save!